/**
 */
package com.logicfishsoftware.plugbench.wPPlugBench.impl;

import com.logicfishsoftware.plugbench.wPPlugBench.FunctionType;
import com.logicfishsoftware.plugbench.wPPlugBench.WPPlugBenchPackage;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.eclipse.emf.ecore.util.EDataTypeEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Function Type</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link com.logicfishsoftware.plugbench.wPPlugBench.impl.FunctionTypeImpl#getType <em>Type</em>}</li>
 *   <li>{@link com.logicfishsoftware.plugbench.wPPlugBench.impl.FunctionTypeImpl#getTag <em>Tag</em>}</li>
 *   <li>{@link com.logicfishsoftware.plugbench.wPPlugBench.impl.FunctionTypeImpl#getPriority <em>Priority</em>}</li>
 *   <li>{@link com.logicfishsoftware.plugbench.wPPlugBench.impl.FunctionTypeImpl#getAcceptedArgs <em>Accepted Args</em>}</li>
 *   <li>{@link com.logicfishsoftware.plugbench.wPPlugBench.impl.FunctionTypeImpl#getAttr <em>Attr</em>}</li>
 *   <li>{@link com.logicfishsoftware.plugbench.wPPlugBench.impl.FunctionTypeImpl#getName <em>Name</em>}</li>
 *   <li>{@link com.logicfishsoftware.plugbench.wPPlugBench.impl.FunctionTypeImpl#getCall <em>Call</em>}</li>
 *   <li>{@link com.logicfishsoftware.plugbench.wPPlugBench.impl.FunctionTypeImpl#getBody <em>Body</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class FunctionTypeImpl extends FunctionImpl implements FunctionType
{
  /**
   * The default value of the '{@link #getType() <em>Type</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getType()
   * @generated
   * @ordered
   */
  protected static final String TYPE_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getType() <em>Type</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getType()
   * @generated
   * @ordered
   */
  protected String type = TYPE_EDEFAULT;

  /**
   * The default value of the '{@link #getTag() <em>Tag</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTag()
   * @generated
   * @ordered
   */
  protected static final String TAG_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getTag() <em>Tag</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTag()
   * @generated
   * @ordered
   */
  protected String tag = TAG_EDEFAULT;

  /**
   * The default value of the '{@link #getPriority() <em>Priority</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getPriority()
   * @generated
   * @ordered
   */
  protected static final int PRIORITY_EDEFAULT = 0;

  /**
   * The cached value of the '{@link #getPriority() <em>Priority</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getPriority()
   * @generated
   * @ordered
   */
  protected int priority = PRIORITY_EDEFAULT;

  /**
   * The default value of the '{@link #getAcceptedArgs() <em>Accepted Args</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getAcceptedArgs()
   * @generated
   * @ordered
   */
  protected static final int ACCEPTED_ARGS_EDEFAULT = 0;

  /**
   * The cached value of the '{@link #getAcceptedArgs() <em>Accepted Args</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getAcceptedArgs()
   * @generated
   * @ordered
   */
  protected int acceptedArgs = ACCEPTED_ARGS_EDEFAULT;

  /**
   * The cached value of the '{@link #getAttr() <em>Attr</em>}' attribute list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getAttr()
   * @generated
   * @ordered
   */
  protected EList<String> attr;

  /**
   * The default value of the '{@link #getName() <em>Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getName()
   * @generated
   * @ordered
   */
  protected static final String NAME_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getName()
   * @generated
   * @ordered
   */
  protected String name = NAME_EDEFAULT;

  /**
   * The default value of the '{@link #getCall() <em>Call</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getCall()
   * @generated
   * @ordered
   */
  protected static final String CALL_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getCall() <em>Call</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getCall()
   * @generated
   * @ordered
   */
  protected String call = CALL_EDEFAULT;

  /**
   * The default value of the '{@link #getBody() <em>Body</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getBody()
   * @generated
   * @ordered
   */
  protected static final String BODY_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getBody() <em>Body</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getBody()
   * @generated
   * @ordered
   */
  protected String body = BODY_EDEFAULT;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected FunctionTypeImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return WPPlugBenchPackage.Literals.FUNCTION_TYPE;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getType()
  {
    return type;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setType(String newType)
  {
    String oldType = type;
    type = newType;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, WPPlugBenchPackage.FUNCTION_TYPE__TYPE, oldType, type));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getTag()
  {
    return tag;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setTag(String newTag)
  {
    String oldTag = tag;
    tag = newTag;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, WPPlugBenchPackage.FUNCTION_TYPE__TAG, oldTag, tag));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public int getPriority()
  {
    return priority;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setPriority(int newPriority)
  {
    int oldPriority = priority;
    priority = newPriority;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, WPPlugBenchPackage.FUNCTION_TYPE__PRIORITY, oldPriority, priority));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public int getAcceptedArgs()
  {
    return acceptedArgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setAcceptedArgs(int newAcceptedArgs)
  {
    int oldAcceptedArgs = acceptedArgs;
    acceptedArgs = newAcceptedArgs;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, WPPlugBenchPackage.FUNCTION_TYPE__ACCEPTED_ARGS, oldAcceptedArgs, acceptedArgs));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<String> getAttr()
  {
    if (attr == null)
    {
      attr = new EDataTypeEList<String>(String.class, this, WPPlugBenchPackage.FUNCTION_TYPE__ATTR);
    }
    return attr;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getName()
  {
    return name;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setName(String newName)
  {
    String oldName = name;
    name = newName;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, WPPlugBenchPackage.FUNCTION_TYPE__NAME, oldName, name));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getCall()
  {
    return call;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setCall(String newCall)
  {
    String oldCall = call;
    call = newCall;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, WPPlugBenchPackage.FUNCTION_TYPE__CALL, oldCall, call));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getBody()
  {
    return body;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setBody(String newBody)
  {
    String oldBody = body;
    body = newBody;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, WPPlugBenchPackage.FUNCTION_TYPE__BODY, oldBody, body));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case WPPlugBenchPackage.FUNCTION_TYPE__TYPE:
        return getType();
      case WPPlugBenchPackage.FUNCTION_TYPE__TAG:
        return getTag();
      case WPPlugBenchPackage.FUNCTION_TYPE__PRIORITY:
        return getPriority();
      case WPPlugBenchPackage.FUNCTION_TYPE__ACCEPTED_ARGS:
        return getAcceptedArgs();
      case WPPlugBenchPackage.FUNCTION_TYPE__ATTR:
        return getAttr();
      case WPPlugBenchPackage.FUNCTION_TYPE__NAME:
        return getName();
      case WPPlugBenchPackage.FUNCTION_TYPE__CALL:
        return getCall();
      case WPPlugBenchPackage.FUNCTION_TYPE__BODY:
        return getBody();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case WPPlugBenchPackage.FUNCTION_TYPE__TYPE:
        setType((String)newValue);
        return;
      case WPPlugBenchPackage.FUNCTION_TYPE__TAG:
        setTag((String)newValue);
        return;
      case WPPlugBenchPackage.FUNCTION_TYPE__PRIORITY:
        setPriority((Integer)newValue);
        return;
      case WPPlugBenchPackage.FUNCTION_TYPE__ACCEPTED_ARGS:
        setAcceptedArgs((Integer)newValue);
        return;
      case WPPlugBenchPackage.FUNCTION_TYPE__ATTR:
        getAttr().clear();
        getAttr().addAll((Collection<? extends String>)newValue);
        return;
      case WPPlugBenchPackage.FUNCTION_TYPE__NAME:
        setName((String)newValue);
        return;
      case WPPlugBenchPackage.FUNCTION_TYPE__CALL:
        setCall((String)newValue);
        return;
      case WPPlugBenchPackage.FUNCTION_TYPE__BODY:
        setBody((String)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case WPPlugBenchPackage.FUNCTION_TYPE__TYPE:
        setType(TYPE_EDEFAULT);
        return;
      case WPPlugBenchPackage.FUNCTION_TYPE__TAG:
        setTag(TAG_EDEFAULT);
        return;
      case WPPlugBenchPackage.FUNCTION_TYPE__PRIORITY:
        setPriority(PRIORITY_EDEFAULT);
        return;
      case WPPlugBenchPackage.FUNCTION_TYPE__ACCEPTED_ARGS:
        setAcceptedArgs(ACCEPTED_ARGS_EDEFAULT);
        return;
      case WPPlugBenchPackage.FUNCTION_TYPE__ATTR:
        getAttr().clear();
        return;
      case WPPlugBenchPackage.FUNCTION_TYPE__NAME:
        setName(NAME_EDEFAULT);
        return;
      case WPPlugBenchPackage.FUNCTION_TYPE__CALL:
        setCall(CALL_EDEFAULT);
        return;
      case WPPlugBenchPackage.FUNCTION_TYPE__BODY:
        setBody(BODY_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case WPPlugBenchPackage.FUNCTION_TYPE__TYPE:
        return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type);
      case WPPlugBenchPackage.FUNCTION_TYPE__TAG:
        return TAG_EDEFAULT == null ? tag != null : !TAG_EDEFAULT.equals(tag);
      case WPPlugBenchPackage.FUNCTION_TYPE__PRIORITY:
        return priority != PRIORITY_EDEFAULT;
      case WPPlugBenchPackage.FUNCTION_TYPE__ACCEPTED_ARGS:
        return acceptedArgs != ACCEPTED_ARGS_EDEFAULT;
      case WPPlugBenchPackage.FUNCTION_TYPE__ATTR:
        return attr != null && !attr.isEmpty();
      case WPPlugBenchPackage.FUNCTION_TYPE__NAME:
        return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
      case WPPlugBenchPackage.FUNCTION_TYPE__CALL:
        return CALL_EDEFAULT == null ? call != null : !CALL_EDEFAULT.equals(call);
      case WPPlugBenchPackage.FUNCTION_TYPE__BODY:
        return BODY_EDEFAULT == null ? body != null : !BODY_EDEFAULT.equals(body);
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (type: ");
    result.append(type);
    result.append(", tag: ");
    result.append(tag);
    result.append(", priority: ");
    result.append(priority);
    result.append(", acceptedArgs: ");
    result.append(acceptedArgs);
    result.append(", attr: ");
    result.append(attr);
    result.append(", name: ");
    result.append(name);
    result.append(", call: ");
    result.append(call);
    result.append(", body: ");
    result.append(body);
    result.append(')');
    return result.toString();
  }

} //FunctionTypeImpl
